package com.zhw.controller;

import com.zhw.pojo.entry.OrderDetail;
import com.zhw.pojo.vo.OrderFormVO;
import com.zhw.pojo.vo.OrderVO;
import com.zhw.pojo.Result;
import com.zhw.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("order")
@Slf4j
public class OrderController {

    @Autowired
    OrderService orderService;

    @GetMapping("getOrder")
    public Result getOrder(Integer id){
        log.info("查看客户：{}的订单信息",id);
        List<OrderVO> list=orderService.getOrder(id);
        return Result.success(list);
    }

    @GetMapping("getOrderForm")
    public Result getOrderForm(Integer id){
        log.info("查看客户：{}的订单信息",id);
        OrderFormVO odv =orderService.getOrderForm(id);
        return Result.success(odv);
    }


    @GetMapping("getOrderTable")
    public Result getOrderTable(Integer id){
        log.info("查看客户：{}的表格订单信息",id);
        List<OrderDetail> list=orderService.getOrderTable(id);
        return Result.success(list);
    }


}
